from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.image import Image
from kivy.uix.label import Label

from os.path import join

class SplashView(GridLayout):
    def __init__(self, **kwargs):
        GridLayout.__init__(self, **kwargs)
        self.cols = 1
        # get the app
        app = App.get_running_app() 
        # text
        text = 'The family that shoots together has'\
            '\noverlapping sectors of fire.'
        label  = Label(text=text,
                       pos_hint={'center_x': 0.5, 'center_y': 0.5})
        label.font_size *= 2
        self.add_widget(label)
        # image
        src = join(app.directory, 'splash.png')
        image = Image(source=src)
        self.add_widget(image)
        # version
        version = app.appdata['version']
        text = 'Version %i.%i.%i' % (version['major'], version['minor'], version['bugfix'])
        label  = Label(text=text,
                       pos_hint={'center_x': 0.5, 'center_y': 0.5})
        self.add_widget(label)
